package com.star.links.views;

public class Block {
    //方块图片
    private BlockImage image;
    //方块左上角坐标
    private int locationX,locationY;
    //方块在二维数组中的索引
    private int indexX,indexY;

    public Block(int indexX, int indexY) {
        this.indexX = indexX;
        this.indexY = indexY;
    }

    public BlockImage getImage() {
        return image;
    }

    public void setImage(BlockImage image) {
        this.image = image;
    }

    public int getLocationX() {
        return locationX;
    }

    public void setLocationX(int locationX) {
        this.locationX = locationX;
    }

    public int getLocationY() {
        return locationY;
    }

    public void setLocationY(int locationY) {
        this.locationY = locationY;
    }

    public int getIndexX() {
        return indexX;
    }

    public void setIndexX(int indexX) {
        this.indexX = indexX;
    }

    public int getIndexY() {
        return indexY;
    }

    public void setIndexY(int indexY) {
        this.indexY = indexY;
    }

    //判断两个方块图片是否相同
    public boolean isSameImage(Block otherBlock){
        if(image==null){
            if(otherBlock.image!=null)
            {
                return false;
            }
        }
        return image.getImageId()==otherBlock.image.getImageId();
    }
}
